Bug 548026 - No accessor for GtkWidget.requisition
authorMichael Natterer <mitch@gimp.org>
Fri, 19 Feb 2010 16:04:20 +0000 (17:04 +0100)
committerMichael Natterer <mitch@gimp.org>
Fri, 19 Feb 2010 16:04:20 +0000 (17:04 +0100)
Add gtk_widget_get_requisition().

gtk/gtk.symbols
gtk/gtkwidget.c
gtk/gtkwidget.h

index d6aa08907d82c3924d8cb2051d6996f11f9beea7..167936dc991bfe5d4092ca7130de4d79568c615e 100644 (file)
@@ -5123,6 +5123,7 @@ gtk_widget_get_parent_window
 gtk_widget_get_pointer
 gtk_widget_get_receives_default
 gtk_widget_get_root_window
+gtk_widget_get_requisition
 gtk_widget_get_screen
 gtk_widget_get_sensitive
 gtk_widget_get_settings
index 0c67bfbb4a72ea6db2e4b96752a7eff7fdea8a79..4adba852996382583edc792f470eddca0bf4ff28 100644 (file)
@@ -11195,6 +11195,32 @@ gtk_widget_set_allocation (GtkWidget           *widget,
   widget->allocation = *allocation;
 }
 
+/**
+ * gtk_widget_get_requisition:
+ * @widget: a #GtkWidget
+ * @requisition: (out): a pointer to a #GtkRequisition to copy to
+ *
+ * Retrieves the widget's requisition.
+ *
+ * This function should only be used by widget implementations in
+ * order to figure whether the widget's requisition has actually
+ * changed after some internal state change (so that they can call
+ * gtk_widget_queue_resize() instead of gtk_widget_queue_draw()).
+ *
+ * Normally, gtk_widget_size_request() should be used.
+ *
+ * Since: 2.20
+ */
+void
+gtk_widget_get_requisition (GtkWidget      *widget,
+                            GtkRequisition *requisition)
+{
+  g_return_if_fail (GTK_IS_WIDGET (widget));
+  g_return_if_fail (requisition != NULL);
+
+  *requisition = widget->requisition;
+}
+
 /**
  * gtk_widget_set_window:
  * @widget: a #GtkWidget
index 757be3f685c7c7142903790ebbe4e61d393959f7..0f361f371c2c0e86b28b3668e9ac7569485dcfd0 100644 (file)
@@ -955,6 +955,9 @@ void                  gtk_widget_get_allocation         (GtkWidget     *widget,
 void                  gtk_widget_set_allocation         (GtkWidget     *widget,
                                                          const GtkAllocation *allocation);
 
+void                  gtk_widget_get_requisition        (GtkWidget     *widget,
+                                                         GtkRequisition *requisition);
+
 gboolean   gtk_widget_child_focus         (GtkWidget           *widget,
                                            GtkDirectionType     direction);
 gboolean   gtk_widget_keynav_failed       (GtkWidget           *widget,